package com.example.yan_music.model;

import com.example.yan_music.bean.UserInfo;
import com.example.yan_music.bean.wangyi.Banner;
import com.example.yan_music.bean.wangyi.Lyric;
import com.example.yan_music.bean.wangyi.NewSearchSong;
import com.example.yan_music.bean.wangyi.NewSongUrl;
import com.example.yan_music.bean.wangyi.RecommendSongList;
import com.example.yan_music.bean.wangyi.SongAlbum;
import com.example.yan_music.bean.wangyi.SongDetail;
import com.example.yan_music.bean.wangyi.SongListDetail;
import com.example.yan_music.model.net.NetworkAction;
import com.example.yan_music.model.net.NetworkActionImp;

import java.util.List;

import io.reactivex.Observable;

/**
 *  M 层
 */
public class DataModel implements NetworkAction {

    // 所有网络操作的实现类
    private NetworkActionImp mNetworkActionImp;

    public DataModel(NetworkActionImp mNetworkActionImp) {
        this.mNetworkActionImp = mNetworkActionImp;
    }

    @Override
    public Observable<UserInfo> login(String phoneNum, String password) {
        return mNetworkActionImp.login(phoneNum, password);
    }

    @Override
    public Observable<NewSearchSong> search(String keywords, int offset) {
        return mNetworkActionImp.search(keywords, offset);
    }

    @Override
    public Observable<NewSongUrl> getSongPlayUrl(int songId) {
        return mNetworkActionImp.getSongPlayUrl(songId);
    }

    @Override
    public Observable<Lyric> getSongLyric(int songId) {
        return mNetworkActionImp.getSongLyric(songId);
    }

    @Override
    public Observable<SongAlbum> getSongAlbum(int songId) {
        return mNetworkActionImp.getSongAlbum(songId);
    }

    @Override
    public Observable<Banner> getBanner() {
        return mNetworkActionImp.getBanner();
    }

    @Override
    public Observable<RecommendSongList> getRecommendSongList(int limit) {
        return mNetworkActionImp.getRecommendSongList(limit);
    }

    @Override
    public Observable<SongListDetail> getPlayListDetail(long songListId) {
        return mNetworkActionImp.getPlayListDetail(songListId);
    }

    @Override
    public Observable<SongDetail> getSongDetail(String ids) {
        return mNetworkActionImp.getSongDetail(ids);
    }
}
